#include "stdio.h"

void quick_sort(int arr[], int l, int r) 
{
	int tmp, i = l, j = r;
	if (i < j) {
		tmp = arr[i];	//取arr[i]，i位置空
		while (i != j) {
			while (i < j && arr[j] >= tmp) j--;	//向左靠
			arr[i] = arr[j];	//取arr[j]填arr[i]，j位置空
			while (i < j && arr[i] < tmp ) i++;
			arr[j] = arr[i]; 	//取arr[i]填arr[j]，i位置空	
		}
		arr[i] = tmp; 
		
		quick_sort(arr, l, i-1);
		quick_sort(arr, i+1, r);
	}
}


void main()
{
	int i,a[]={27,70,33,82,100,29,5,14,33,50};
	int len = sizeof(a)/sizeof(a[0]);
	quick_sort(a,0,len-1);
	for(i=0; i<len; i++)
		printf("%d ", a[i]);
}